package OT.shoufouni.serverThreads;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import android.util.Log;

public class serverLogoutQuaryThread extends Thread {
   private final String emailText;
   public serverLogoutQuaryThread( String email) {
      this.emailText = email;
    }
   public void run() {
	   String receivedData = httpGet(emailText);
   }
   private String httpGet(String srcText) {
	   String requestUrl;
	   StringBuilder builder = new StringBuilder();
       try {
    	   requestUrl = "http://10.0.2.2:8080/serverRestSide2/logout/"+srcText;
    	   try {
               URL url = new URL(requestUrl.toString());
               BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
               String inputLine = null;
               Log.d("serverLogoutQuaryThread ","-----RESPONSE START-----" +" id="+ Thread.currentThread().getId());
               while ((inputLine = in.readLine()) != null) {
            	   builder.append(inputLine);
               }
               in.close();
               Log.d("serverLogoutQuaryThread ",builder.toString());
               Log.d("serverLogoutQuaryThread ","-----RESPONSE END-----" +" id="+ Thread.currentThread().getId());
               
           } catch (IOException e) {
        	   Log.e("serverLogoutQuaryThread ",e.getMessage());
               return "BAD";
           }
       }finally{
    	   
       }
       return builder.toString();
   	}
   
   
}
